/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package au.edu.swin.bank.persistence.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author scott
 */
@Entity
@Table(name = "BANKTRANSACTIONTYPE")
@NamedQueries({
    @NamedQuery(name = "BankTransactionType.findAll", query = "SELECT b FROM BankTransactionType b"),
    @NamedQuery(name = "BankTransactionType.findByTranstype", query = "SELECT b FROM BankTransactionType b WHERE b.transtype = :transtype")})
public class BankTransactionType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "TRANSTYPE")
    private Character transtype;
    @OneToMany(mappedBy = "bankTransactionType")
    private Collection<BankTransaction> bankTransactionCollection;

    public BankTransactionType() {
    }

    public BankTransactionType(Character transtype) {
        this.transtype = transtype;
    }

    public Character getTranstype() {
        return transtype;
    }

    public void setTranstype(Character transtype) {
        this.transtype = transtype;
    }

    public Collection<BankTransaction> getBankTransactionCollection() {
        return bankTransactionCollection;
    }

    public void setBankTransactionCollection(Collection<BankTransaction> bankTransactionCollection) {
        this.bankTransactionCollection = bankTransactionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transtype != null ? transtype.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BankTransactionType)) {
            return false;
        }
        BankTransactionType other = (BankTransactionType) object;
        if ((this.transtype == null && other.transtype != null) || (this.transtype != null && !this.transtype.equals(other.transtype))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "au.edu.swin.bank.persistence.entity.BankTransactionType[transtype=" + transtype + "]";
    }

}
